from django.http import HttpResponse
from django.contrib.auth.decorators import login_required

#@login_required
def index(request):
	session = request.session
	try:
		session.lock('count')
		if 'count' not in session:
			session['count'] = 1
		else:
			session['count'] += 1
		if session['count'] == 10:
			del session['count']
			session['count'] = 0
		print 'count:', session['count']
		session.unlock('count')
		return HttpResponse(session['count'])
	except Exception, ex:
		print ex
		return HttpResponse(ex)

